<?php

$db = new PDO("mysql:host=localhost;dbname=japword", 'root', '', array( PDO::ATTR_PERSISTENT => false));
$query = "SELECT * FROM terms LEFT JOIN terms parent ON terms.id_term = parent.id_term";

$st = $db->prepare($query);
$st->execute();
foreach(range(0, $st->columnCount() - 1) as $column_index) {
	$meta[] = $st->getColumnMeta($column_index);
}
echo "<pre>";
print_r($meta);
$refl = new ReflectionClass('PDO');
print_r($refl->getConstants());
?>